package com.whfc.base.enums;

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

/**
 * @Description: 业务模块
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/11/30 11:26
 */
public enum AppModuleType {

    MACH(1, "设备"),
    EMP(2, "人员"),
    MAM(3, "物资"),
    ENV(4, "环境"),
    FIM(5, "智能监控"),
    FSE(6, "特种设备"),
    EQUIP(7, "考勤设备"),
    QUALITY(8, "质量管理"),
    SAFETY(9, "安全管理"),
    CHECK(10, "审批"),
    ROTARY(11, "旋挖设备");



    private Integer value;

    private String desc;

    AppModuleType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer value() {
        return value;
    }

    public static AppModuleType parseValue(Integer moduleType) {
        switch (moduleType) {
            case 1:
                return MACH;
            case 2:
                return EMP;
            case 3:
                return MAM;
            case 4:
                return ENV;
            case 5:
                return FIM;
            case 6:
                return FSE;
            case 7:
                return EQUIP;
            case 8:
                return QUALITY;
            case 9:
                return SAFETY;
            case 10:
                return ROTARY;
            default:
                return null;
        }
    }

    public enum WarnMessageEnum {
        MACH(1, "设备报警", 1),
        EMP(2, "人员报警", 1),
        ENV(4, "环境报警", 1),
        FIM(5, "智能监控报警", 1),
        FSE(6, "特种设备报警", 1),
        QUALITY(8, "质量报警", 0),
        SAFETY(9, "安全报警", 0),
        CHECK(10, "审批提醒", 0),
        ;
        private Integer code;
        private String desc;
        //1-报警消息 0-提醒消息
        private Integer type;

        WarnMessageEnum(Integer code, String desc, Integer type) {
            this.code = code;
            this.desc = desc;
            this.type = type;
        }

        public static List<Integer> getModuleTypes(Integer type) {
            List<Integer> data = new ArrayList<>();
            for (WarnMessageEnum v : WarnMessageEnum.values()) {
                if (v.type.equals(type)) {
                    data.add(v.code);
                }
            }
            return data;
        }
    }


}
